package edu.neu.ecommerce.schedule.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;

/**
 * <h1>定时任务实体类定义</h1>
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("tb_schedule_job")
public class ScheduleJobEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /* 任务调度参数key */
    public static final String JOB_PARAM_KEY = "JOB_PARAM_KEY";

    /* 作业id */
    @TableId
    private Long jobId;

    /* spring bean名称 */
    @NotBlank(message="bean名称不能为空")
    private String beanName;

    /* 参数 */
    private String params;

    /* cron表达式 */
    @NotBlank(message="cron表达式不能为空")
    private String cronExpression;

    /* 任务状态 */
    private Integer status;

    /* 备注 */
    private String remark;

    /* 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
}
